﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Manager.master" AutoEventWireup="true" CodeFile="MailBox.aspx.cs" Inherits="User_MailBox" EnableEventValidation="true" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <style>
        .HeaderText
        {
            color: #0577B6;
            font-weight: bold;
        }
    </style>
    <div style="margin:0 auto">
        <div class="content_area1">
            <h1>Hộp thư đến</h1>
            <div style="margin-left:20px;">
                <div style="width:648px">
                    <div style="margin-bottom: 10px; float: right; height: 30px;">
                        <div class="LeftOfButton">
                            <div class="RightOfButton">
                                <div class="MidOfButton">
                                    <a href="<%= ResolveUrl("~/Compose.html")%>">Soạn thư</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
                <asp:GridView ID="grvInbox" runat="server" AutoGenerateColumns="false" OnPageIndexChanging="grvInbox_PageIndexChanging" 
                    AllowPaging="true" PageSize="20" Width="97%" CssClass="tableStyle" 
                    OnRowCommand="grvInbox_RowCommand" onrowdatabound="grvInbox_RowDataBound">
                    <Columns>
                        <asp:TemplateField ItemStyle-Width="35%" ItemStyle-HorizontalAlign="Left" HeaderText="Tiêu đề">
                            <ItemTemplate>
                                <a href='<%# String.Format(MailDetail("{0}"),Eval("Id")) %>'><%# Eval("Subject")%></a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField ItemStyle-Width="30%" HeaderText="Người gửi">
                            <ItemTemplate>
                                <%# Eval("UserEmail")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField ItemStyle-Width="15%" HeaderText="Ngày nhận">
                            <ItemTemplate>
                                <%# Eval("ReceiveDate","{0:d}") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField ItemStyle-Width="11%" ItemStyle-HorizontalAlign="Center" HeaderText="Tùy chọn">
                            <ItemTemplate>
                                <asp:ImageButton ID="btndelete" runat="server" ImageUrl="~/images/Delete.png" CommandName="deleteInbox" 
                                    CommandArgument='<%#Eval("Id") %>' OnClientClick="return confirm('Bạn có chắc muốn xóa không ?');" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="false">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkRead" runat="server" Checked='<%# MailStatus(Eval("Status").ToString()) %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <b>No Email here</b>
                    </EmptyDataTemplate>
                    <PagerSettings PageButtonCount="50" Position="Bottom" />
                </asp:GridView>
            </div>            
            <br class="clear" />
            <img src="<%= ResolveUrl("~/images/bottom.jpg")%>" align="absbottom" alt="" />
        </div>
        <div class="content_area1">
            <h1>Hộp thư đi</h1>
            <div style="margin-left:20px;">
                <asp:GridView ID="grvOutbox" runat="server" AutoGenerateColumns="false" OnPageIndexChanging="grvInbox_PageIndexChanging" 
                    AllowPaging="true" PageSize="20" Width="97%" CssClass="tableStyle" OnRowCommand="grvOutbox_RowCommand">
                    <Columns>
                        <asp:TemplateField ItemStyle-Width="35%" ItemStyle-HorizontalAlign="Left" HeaderText="Tiêu đề">
                            <ItemTemplate>
                                <a href='<%# String.Format(MailDetail("{0}"),Eval("Id")) %>'><%# DataBinder.Eval(Container.DataItem, "Subject")%></a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField ItemStyle-Width="30%" HeaderText="Người nhận">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "UserEmail")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField ItemStyle-Width="15%" HeaderText="Ngày gửi">
                            <ItemTemplate>
                                <%# Eval("CreateDate", "{0:d}")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField ItemStyle-Width="11%" ItemStyle-HorizontalAlign="Center" HeaderText="Tùy chọn">
                            <ItemTemplate>
                                <asp:ImageButton ID="btndelete" runat="server" ImageUrl="~/images/Delete.png" CommandName="deleteOutbox" 
                                    CommandArgument='<%#DataBinder.Eval(Container.DataItem, "Id") %>' OnClientClick="return confirm('Bạn có chắc muốn xóa không ?');" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <b>No Email here</b>
                    </EmptyDataTemplate>
                    <PagerSettings PageButtonCount="50" Position="TopAndBottom" />
                </asp:GridView>
            </div>
            <br class="clear" />
            <img src="<%= ResolveUrl("~/images/bottom.jpg")%>" align="absbottom" alt="" />
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
</asp:Content>

